﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GamePlayPanel : MonoBehaviour
{
    public static GamePlayPanel Instance;

    //public Button Button_Pause;

    public Button Button_Left;
    public Button Button_Right;
    public Button Button_Down;
    public Button Button_Change;

    private void Awake()
    {
        Instance = this;
    }

    void Start()
    {
        EventTriggerListener.Get(Button_Left.gameObject, null).onClick = (GameObject go, object data) =>
        {
            ShuaiManager.Instance.current_element.Move(Vector2.left);
        };
        EventTriggerListener.Get(Button_Right.gameObject, null).onClick = (GameObject go, object data) =>
        {
            ShuaiManager.Instance.current_element.Move(Vector2.right);
        };
        EventTriggerListener.Get(Button_Down.gameObject, null).onClick = (GameObject go, object data) =>
        {
            CellFunctions.MoveDownAllCell();
        };
        EventTriggerListener.Get(Button_Change.gameObject, null).onClick = (GameObject go, object data) =>
        {
            ShuaiManager.Instance.current_element.Change();
        };

        //EventTriggerListener.Get(Button_Pause.gameObject, null).onClick = (GameObject go, object data) =>
        //{

        //};
    }

    public void Open()
    {
        this.gameObject.SetActive(true);
    }

    public void Close()
    {
        this.gameObject.SetActive(false);
    }
}
